package com.qishao.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

/**
 * @Title：LogBackConfig.java
 * @Author：XUSHAOQI
 * @DATE：2021/12/13
 */
@Component
@Configuration
public class LogBackConfig {
    private final Logger LOG = LoggerFactory.getLogger(this.getClass());

    @Value("${server.port}")
    private String port;

    @Bean
    public ApplicationRunner applicationRunner(){
        return ApplicationArguments -> {
            InetAddress localHost = InetAddress.getLocalHost();
            LOG.info("服务启动成功："+"Http://"+localHost.getHostAddress()+":"+port+"/");

        };
    }



}
